package com.ruoyi.zsyh.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhAgentOrderRelMapper;
import com.ruoyi.zsyh.domain.ZsyhAgentOrderRel;
import com.ruoyi.zsyh.service.IZsyhAgentOrderRelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 大区会长预订单详细Service业务层处理
 * 
 * @author yuexl
 * @date 2021-12-15
 */
@Service
public class ZsyhAgentOrderRelServiceImpl implements IZsyhAgentOrderRelService 
{
    @Autowired
    private ZsyhAgentOrderRelMapper zsyhAgentOrderRelMapper;

    /**
     * 查询大区会长预订单详细
     * 
     * @param id 大区会长预订单详细ID
     * @return 大区会长预订单详细
     */
    @Override
    public ZsyhAgentOrderRel selectZsyhAgentOrderRelById(String id)
    {
        return zsyhAgentOrderRelMapper.selectZsyhAgentOrderRelById(id);
    }

    /**
     * 查询大区会长预订单详细列表
     * 
     * @param zsyhAgentOrderRel 大区会长预订单详细
     * @return 大区会长预订单详细
     */
    @Override
    public List<ZsyhAgentOrderRel> selectZsyhAgentOrderRelList(ZsyhAgentOrderRel zsyhAgentOrderRel)
    {
        return zsyhAgentOrderRelMapper.selectZsyhAgentOrderRelList(zsyhAgentOrderRel);
    }

    /**
     * 新增大区会长预订单详细
     * 
     * @param zsyhAgentOrderRel 大区会长预订单详细
     * @return 结果
     */
    @Override
    public int insertZsyhAgentOrderRel(ZsyhAgentOrderRel zsyhAgentOrderRel)
    {
        zsyhAgentOrderRel.setCreateTime(DateUtils.getNowDate());
        return zsyhAgentOrderRelMapper.insertZsyhAgentOrderRel(zsyhAgentOrderRel);
    }

    /**
     * 修改大区会长预订单详细
     * 
     * @param zsyhAgentOrderRel 大区会长预订单详细
     * @return 结果
     */
    @Override
    public int updateZsyhAgentOrderRel(ZsyhAgentOrderRel zsyhAgentOrderRel)
    {
        zsyhAgentOrderRel.setUpdateTime(DateUtils.getNowDate());
        return zsyhAgentOrderRelMapper.updateZsyhAgentOrderRel(zsyhAgentOrderRel);
    }

    /**
     * 删除大区会长预订单详细对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAgentOrderRelByIds(String ids)
    {
        return zsyhAgentOrderRelMapper.deleteZsyhAgentOrderRelByIds(Convert.toStrArray(ids));
    }

    public Integer updateZsyhAgentOrderRelBatch(List<ZsyhAgentOrderRel> list){
        return zsyhAgentOrderRelMapper.updateZsyhAgentOrderRelBatch(list);
    }

    /**
     * 删除大区会长预订单详细信息
     * 
     * @param id 大区会长预订单详细ID
     * @return 结果
     */
    @Override
    public int deleteZsyhAgentOrderRelById(String id)
    {
        return zsyhAgentOrderRelMapper.deleteZsyhAgentOrderRelById(id);
    }

    @Override
    public List<ZsyhAgentOrderRel> selectZsyhAgentOrderRelCurrentMonth(ZsyhAgentOrderRel zsyhAgentOrderRel) {
        return zsyhAgentOrderRelMapper.selectZsyhAgentOrderRelCurrentMonth(zsyhAgentOrderRel);
    }


    @Override
    public List<ZsyhAgentOrderRel> getAgentOrderRelMonthStatistics(ZsyhAgentOrderRel zsyhAgentOrderRel) {
        return zsyhAgentOrderRelMapper.getAgentOrderRelMonthStatistics(zsyhAgentOrderRel);
    }

    public List<Map> getFactorySalesVolume(String startDate, String endDate, String factoryId){
        return zsyhAgentOrderRelMapper.getFactorySalesVolume(startDate, endDate, factoryId);
    }

    public List<Map> getFactorySalesVolumeAgent(String startDate, String endDate, String factoryId, String partsId){
        return zsyhAgentOrderRelMapper.getFactorySalesVolumeAgent(startDate, endDate, factoryId, partsId);
    }

    public List<Map> getFactorySalesVolumeOrderRel(String startDate, String endDate, String factoryId, String partsId, String agentId, String isOrder){
        return zsyhAgentOrderRelMapper.getFactorySalesVolumeOrderRel(startDate, endDate, factoryId, partsId, agentId, isOrder);
    }

    public Map getAgentOrderRelOrderCount(String attributeId){
        return zsyhAgentOrderRelMapper.getAgentOrderRelOrderCount(attributeId);
    }
    public Map getAgentTaskAll(Map map){
        return zsyhAgentOrderRelMapper.getAgentTaskAll(map);
    }
}
